package com.github.yeecode.mybatisdemo;

import com.github.yeecode.mybatisdemo.dao.StoreMapper;
import com.github.yeecode.mybatisdemo.entity.Page;
import com.github.yeecode.mybatisdemo.model.Store;
import com.github.yeecode.mybatisdemo.model.User;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;


public class DemoApplicationAllInpay {
    public static void main(String[] args) {
        String resource = "mybatis-config-allinpay.xml";
        InputStream inputStream = null;
        try {
            inputStream = Resources.getResourceAsStream(resource);
        } catch (IOException e) {
            e.printStackTrace();
        }
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);

        try (SqlSession session = sqlSessionFactory.openSession()) {
/*
            Store obj = session.selectOne("com.github.yeecode.mybatisdemo.dao.StoreDao.selectByStoreNo", "2105531100005003");

            System.out.println(obj.toString());

            List list = session.selectList("com.github.yeecode.mybatisdemo.dao.StoreDao.findStorePage", new Page(1, 5));

            System.out.println(list.toString());*/

          //  List<Store>  list1 = session.selectList("com.github.yeecode.mybatisdemo.dao.StoreDao.findOneStoreVoiceByStoreNo", "2105531100005003");

            //System.out.println(list1.toString());

            StoreMapper mapper = session.getMapper(StoreMapper.class);
            Store store = mapper.selectByStoreNo("2105531100005003");



        }
    }
}
